package com.rzjm.api.netty.water.constant;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * @author WangWT
 * @Description: 设备上报数据type
 * @date 2023/3/31 16:31
 */
@Getter
@RequiredArgsConstructor
public enum ReceiveTypeEnum {

    RECEIVE_TYPE_0(0, "设备版本上报"),
    RECEIVE_TYPE_1 (1, "上传心跳"),
    RECEIVE_TYPE_2(2, "上传水卡信息（刷卡）"),
	RECEIVE_TYPE_3(3, "取水完成（红色停止按钮）"),
    RECEIVE_TYPE_4(4, "服务器下发出水"),
    RECEIVE_TYPE_5(5, "广告灯控制"),
    RECEIVE_TYPE_6(6, "温控控制"),
    RECEIVE_TYPE_7(7, "清除故障码"),
    RECEIVE_TYPE_8(8, "清洗水罐参数设置"),
    RECEIVE_TYPE_9(9, "开始出水(按绿色按钮)"),
    RECEIVE_TYPE_10(10, "单片机复位"),
    RECEIVE_TYPE_11(11, "臭氧主动控制状态"),

    RECEIVE_TYPE_45(45, "请求固件包数据"),
    RECEIVE_TYPE_97(97, "接收数据后应答"),
    RECEIVE_TYPE_98(98, "设备故障状态"),
    RECEIVE_TYPE_99(99, "接收数据后应答"),
    RECEIVE_TYPE_100(100, "签名错误");

    private final int type;
    private final String description;

    /**
     * 根据type获取枚举
     *
     * @param type
     * @return
     */
    public static ReceiveTypeEnum getByType(int type){
        for(ReceiveTypeEnum typeEnum:values()){
            if(typeEnum.getType() == type){
                return typeEnum;
            }
        }
        return null;
    }
}
